package com.aspose.cells;

class zbus extends zbz {
   zbus() {
      this.c(4127);
      this.b(42);
      this.c = new byte[42];
      this.c[40] = 31;
      this.c[41] = 1;
   }

   void a(Axis var1) throws Exception {
      try {
         double var2;
         if (!var1.e()) {
            if (var1.getMinValue() instanceof Double) {
               var2 = (Double)var1.getMinValue();
            } else {
               var2 = ((DateTime)var1.getMinValue()).h();
            }

            if (var1.isLogarithmic()) {
               var2 = Math.log10(var2);
               var2 = b(var2);
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, this.c, 0, 8);
            this.c[40] = (byte)(this.c[40] & 254);
         }

         if (!var1.f()) {
            if (var1.getMaxValue() instanceof Double) {
               var2 = (Double)var1.getMaxValue();
            } else {
               var2 = ((DateTime)var1.getMaxValue()).h();
            }

            if (var1.isLogarithmic()) {
               var2 = Math.log10(var2);
               var2 = this.a(var2);
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, this.c, 8, 8);
            this.c[40] = (byte)(this.c[40] & 253);
         }

         if (!var1.g()) {
            var2 = var1.getMajorUnit();
            if (var1.isLogarithmic()) {
               var2 = Math.log10(var2);
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, this.c, 16, 8);
            this.c[40] = (byte)(this.c[40] & 251);
         }

         if (!var1.h()) {
            var2 = var1.getMinorUnit();
            if (var1.isLogarithmic()) {
               var2 = Math.log10(var2);
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, this.c, 24, 8);
            this.c[40] = (byte)(this.c[40] & 247);
         }

         if (var1.getCrossType() == 2) {
            var2 = var1.getCrossAt();
            if (var1.isLogarithmic()) {
               var2 = Math.log10(var2);
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, this.c, 32, 8);
            this.c[40] = (byte)(this.c[40] & 239);
         } else if (var1.getCrossType() == 1) {
            this.c[40] = (byte)(this.c[40] | 128);
         }

         if (var1.isLogarithmic()) {
            this.c[40] = (byte)(this.c[40] | 32);
         }

         if (var1.isPlotOrderReversed()) {
            this.c[40] = (byte)(this.c[40] | 64);
         }

      } catch (Exception var4) {
         Exception var3 = new Exception("Negative or zero values cannot be plotted correctly on log charts.", var4);
         throw var3;
      }
   }

   private double a(double var1) {
      boolean var3 = true;
      if (var1 < 0.0D) {
         var3 = false;
      }

      var1 = Math.abs(var1);
      double var4;
      if (var3) {
         var4 = (double)((int)Math.floor(var1));
         if (var4 != var1) {
            ++var4;
         }

         return var4;
      } else {
         var4 = (double)((int)Math.floor(var1));
         return -var4;
      }
   }

   private static double b(double var0) {
      boolean var2 = true;
      if (var0 < 0.0D) {
         var2 = false;
      }

      var0 = Math.abs(var0);
      double var3;
      if (!var2) {
         var3 = (double)((int)Math.floor(var0));
         if (var3 != var0) {
            ++var3;
         }

         return -var3;
      } else {
         var3 = (double)((int)Math.floor(var0));
         return var3;
      }
   }
}
